<template>
  <tab-bar>
    <div class="user" slot="main">
      <div class="top" style="padding: 1rem 0;">
        <router-link to="/corp-info" class="avatar">
          <img src="../../../static/images/corp.png" alt="">
        </router-link>
        <div class="nickname">{{userInfo.aab004}}</div>
      </div>
      <div class="list">
        <mt-cell is-link to="#/corp-message">
          <i class="xffont xf-zhanneixin list-icon" slot="icon"></i>
          <span slot="title" class="list-title">站内信</span>
        </mt-cell>
        <mt-cell is-link to="#/corp-query">
          <i class="xffont xf-search list-icon" slot="icon"></i>
          <span slot="title" class="list-title">单位综合查询</span>
        </mt-cell>
        <mt-cell is-link to="#/sys">
          <i class="xffont xf-shezhi list-icon" slot="icon"></i>
          <span slot="title" class="list-title">系统设置</span>
        </mt-cell>
      </div>
    </div>
  </tab-bar>
</template>
<script>
  import TabBar from '../../layouts/tab-bar/index.vue'
  import {mapGetters, mapMutations} from 'vuex'
  import {delNull} from '../../common/js/util'

  export default {
    components: {TabBar},
    computed: {
      ...mapGetters([
        'userInfo'
      ])
    },
    data() {
      return {}
    },
    methods: {
      ...mapMutations({
        setUserInfo: 'SET_USER_INFO'
      }),
      getCorpInfo() {
        this.$post('/sapi/public/system/corp/get', {
          corpId: this.userInfo.aab001
        }).then(res => {
          delNull(res.data)
          this.setUserInfo(Object.assign({}, this.userInfo, res.data))
        })
      }
    },
    created() {
      this.getCorpInfo()
    }
  }
</script>
<style lang="scss" scoped>
  @import "../../common/style/user";

  .user .list {
    padding: 0;
  }
</style>
